<div class="main-controller">
    <!-- 按钮控制区 -->
    <div class="flt">
        <if condition="$upr['customer_edit']">
            <a href="{:U('Customer/customer_edit')}" class="btn-icon btn-plus lnk-add">新增</a>
        </if>        
        <a href="{:U('Customer/customer_import')}" class="btn-import btn-plus lnk-add">导入</a>
        <a href="{:U('Customer/customer_export')}" class="btn-export btn-plus lnk-add">导出</a>
        <a href="{:U('Customer/dispatch_edit')}" class="btn-icon btn-plus lnk-add">批量调度</a>
        <a href="{:U('Customer/customer_edit')}" class="btn-icon btn-plus lnk-add">批量删除</a>
        <a href="#" class="btn-refresh lnk-refresh">刷新</a>
    </div>
    <!-- /按钮控制区 -->
    <!-- 搜索区 -->
    <div class="frt">
        <form method="get" action="__SELF__">
            <input type="text" name="keyword" placeholder="模糊查询名称字段" class="keyword" /><button class="btn-search">查询</button><button class="btn-options" onclick="return btn_search_adv_click();">高级</button>
        </form>
        <div class="search-adv hidden">
            <form method="get" action="__SELF__">
                <table class="table-form">
                    <tr><th>编号：</th><td><input type="text" name="sn" placeholder="客户编号" value="{$search.sn}" /></td></tr>
                    <tr><th>客户姓名：</th><td><input type="text" name="personalName" placeholder="客户姓名" value="{$search.personalName}" /></td></tr>
                    <tr><th>客户电话：</th><td><input type="text" name="tel" placeholder="客户电话" value="{$search.tel}" /></td></tr>
                    <tr><th>工号：</th><td><input type="text" name="userName" placeholder="工号" value="{$search.userName}" /></td></tr>
                    <tr><th>座席姓名：</th><td><input type="text" name="agentPersonalName" placeholder="座席姓名" value="{$search.agentPersonalName}" /></td></tr>
                    <tr><th>购买次数(大于/次)：</th><td><input type="text" name="buycount" value="{$search.buycount}" /></td></tr>
                    <tr><th>累计消费(大于/元)：</th><td><input type="text" name="buyamount" value="{$search.buyamount}" /></td></tr>
                    <tr><th>上次消费日期(早于)：</th><td><input type="text" name="lastbuytime" value="{$search.lastbuytime}" class="datepicker" /></td></tr>
                    <tr><th>营销日期：</th><td><input type="text" name="createdTime" value="{$search.createdTime}" class="datepicker" /></td></tr>
                </table>
            </form>
        </div>
    </div>
    <!-- /搜索区 -->
    <div class="clearfix"></div>
</div>
<div class="radio-button-set" data-value="{$search.tab}">
    <input type="radio" id='listTab-item1' name="listTab" checked="checked" value='all'><label for="listTab-item1">所有客户</label><td>
        <input type="radio" id='listTab-item2' name="listTab" value='new'><label for="listTab-item2">最近联系</label><td>
        <input type="radio" id='listTab-item3' name="listTab" value='interested'><label for="listTab-item3">意向客户</label><td>
        <input type="radio" id='listTab-item4' name="listTab" value='appointment_user'><label for="listTab-item4">预约客户</label><td>
        <input type="radio" id='listTab-item5' name="listTab" value='appointment_order'><label for="listTab-item5">订单回访</label><td>
        <input type="radio" id='listTab-item6' name="listTab" value='overdue'><label for="listTab-item6">超期客户预警</label><td>
        <input type="radio" id='listTab-item7' name="listTab" value='dispatch'><label for="listTab-item7">调度客户</label><td>
        <input type="radio" id='listTab-item8' name="listTab" value='recycle'><label for="listTab-item8">回收站</label><td>
</div>
<div id="main-content">
    {$list_content}
</div>
<script type="text/javascript">
    $('.breadcrumb').append($('.radio-button-set'));
    $('input[name="listTab"][value="' + $('.radio-button-set').data('value') + '"]').prop('checked', true);
    $('.search-panel .lnk-submit').click(function () {
        var $frm = $('.search-panel form');
        $frm.find('input[name="action"]').val($(labelis).text() == '导出' ? 'export' : 'display');
        $frm.submit();
    })
    $('input[name="listTab"]').change(function () {
        var url = location.href;
        var val = $(this).val();
        if (url.indexOf('tab=') > -1) {
            var reg = new RegExp(/tab=\w+/g);
            url = url.replace(reg, 'tab=' + val);
        } else {
            url += (url.indexOf('?') > -1 ? '&' : '?') + 'tab=' + val;
        }
        location.href = url;
    })
    // 高级查询按钮点击事件
    // 2015-3-16 by sutroon
    function btn_search_adv_click() {
        $('.search-adv').dialog({'title': '高级搜索', width:338,
            buttons: {
                "查询": function () {
                    $('.search-adv form')[0].submit();
                },
                '重置': function () {
                    $('.search-adv form')[0].reset();
                },
                '关闭': function () {
                    $('.search-adv').dialog("close");
                }
            }
        });
        return false;
    }

    /**
     * 关闭对话框
     * @param {string} selector 对话框选择器
     * @returns {Boolean}
     * @since 1.0 2015-3-16 by sutroon
     */
    function close_dialog(selector) {
        $(selector).dialog('close', true);
        return false;
    }
</script>